package edison.jcr.nodetype;

import java.util.ArrayList;
import java.util.List;

import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NodeDefinition;
import javax.jcr.nodetype.NodeTypeTemplate;
import javax.jcr.nodetype.PropertyDefinition;
import edison.jcr.SessionContext;

public class NodeTypeTemplateImpl extends NodeTypeDefinitionImpl implements NodeTypeTemplate {

	NodeTypeTemplateImpl(SessionContext context) {
		super(context);
	}

	public void setName(String name) throws ConstraintViolationException {
		this.name = name;
	}

	public void setDeclaredSuperTypeNames(String[] names) throws ConstraintViolationException {
		this.declaredSupertypeNames = names;
	}

	public void setAbstract(boolean abstractStatus) {
		this.isAbstract = abstractStatus;
	}

	public void setMixin(boolean mixin) {
		this.isMixin = mixin;
	}

	public void setOrderableChildNodes(boolean orderable) {
		this.hasOrderableChildNodes = orderable;
	}

	public void setPrimaryItemName(String name) throws ConstraintViolationException {
		this.primaryItemName = name;
	}

	public void setQueryable(boolean queryable) {
		this.isQueryable = queryable;
	}

	public List<PropertyDefinition> getPropertyDefinitionTemplates() {
		if(declaredPropertyDefinitions==null)
			declaredPropertyDefinitions=new ArrayList<PropertyDefinition>();
		return declaredPropertyDefinitions;
	}

	public List<NodeDefinition> getNodeDefinitionTemplates() {
		if(declaredChildNodeDefinitions==null)
			declaredChildNodeDefinitions=new ArrayList<NodeDefinition>();
		return declaredChildNodeDefinitions;
	}

}